#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
	char tp[20];
	gets(tp);
	long long size,n,q,num,j;
	if(tp[0]=='i')
		size=4;
	else if(tp[0]=='c')
		size=1;
	else if(tp[0]=='f')
		size=4;
	else if(tp[0]=='d')
		size=8;
	else 
		size=8;
	scanf("%lld%lld",&n,&q);
	for(int i=0;i<q;i++)
	{					
		scanf("%lld",&j);
		if(j>=n || j<0)
			printf("Careless Otter!\n");
		else
		{
			num=j*size;
			printf("0x%08x\n",num);	
		}			
	}					 
	return 0;
}